<template>
	<div class="jumbotron">
		<table class="table table-striped">
			<thead align="right">
				<tr>
					<th>职位名称</th>
					<th>工作地点</th>
					<th>职位描述</th>
					<th>月薪</th>
					<th>被投递次数</th>
					<th>职位TAG</th>
					<th>状态</th>
				</tr>
			</thead>
			<tbody>
				<tr v-for="item in jobList">
					<td>{{item.jobName}}</td>
					<td>{{item.region}}</td>
					<td>{{item.jobDescrip}}</td>
					<td>{{item.salaryMin===0&&item.salaryMax===0?"面议":item.salaryMin+"~"+item.salaryMax}}</td>
					<td>{{item.postedNum}}</td>
					<td>
						{{(JSON.stringify(JSON.parse(item.tag)).replace(/\"/g,"").replace("["," ").replace("]"," ").replace(/ /g,"")==="")
						?"无"
						:JSON.stringify(JSON.parse(item.tag)).replace(/\"/g,"").replace("["," ").replace("]"," ").replace(/,/g," / ")}}
					</td>
					<td>
						<button type="button" class="btn btn-primary" v-if="item.jobCheckStatus===0">待查看</button>
						<button type="button" class="btn btn-danger" v-if="item.jobCheckStatus===1">未通过</button>
						<button type="button" class="btn btn-success" v-if="item.jobCheckStatus===2">简历通过</button>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</template>

<script>
	module.exports = {
		data: function() {
			return {
				sysUser: {
					id: 0,
				},
				jobList: []
			}
		},
		mounted() {
			this.sysUser = JSON.parse(localStorage.getItem('sysUser'));
			$.ajax({
				url: conf.ur + "/api/jobHunter/postResumeStatus?id=" + this.sysUser.id,
				type: 'get',
				dataType: 'json',
				headers: {
					"Content-Type": "application/json",
					"x-auth-token": window.localStorage.getItem('x-auth-token')
				},
				success: (data) => {
					console.log(JSON.stringify(data))
					if (data.code === 0) {
						this.jobList = data.data;
					} else {
						console.log("网络异常！")
					}
				},
				error: (err) => {
					console.log("网络异常！")
				}
			});
		},
		methods: {

		}
	}
</script>
